<?php
/***************************************************************************
 *
 *   copyright            : (C) 2005 Winds of Storm
 *
 *   $Id: topic.php,v 1.10 2007/11/08 20:39:07 amorgan Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

require("config.php");
$body['class']	= 'row1';
$body['id']	= 'topic';
$skip_header	= 1;
require($libdir . "init." . $phpEx);
require($libdir . "chat_functs." . $phpEx);

$sid	= $_REQUEST['sid'];
$sql	= "SELECT *
		FROM
			{$dbprefix}sessions AS s,
			{$dbprefix}rooms AS r
		WHERE	
			s.session_id='$sid' AND
			s.room_id=r.room_id";
print("<!-- {$sql} -->\n");
$result	= $db->sql_query($sql);
$rows	= $db->sql_numrows($result);

if ($rows == 0) {
	showFatalError("<h2 class=msg>Session Expired.</h2>");
}

$p_row	= $db->sql_fetchrow($result);
$topic	= $p_row['room_topic'];

$body['text']	= $topic;
setDomainText(__FILE__, &$header, $_REQUEST['cpsp']);
showHeader($body, $header);

